package top.buyibuyi.course.controller.admin;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.buyibuyi.course.R;
import top.buyibuyi.course.pojo.Admin;
import top.buyibuyi.course.service.admin.SaveAdminService;

@RestController
@RequestMapping("/admin")
@CrossOrigin
public class SaveAdminController {
    @Autowired
    private SaveAdminService saveAdminService;

    @PostMapping("/saveAdmin")
    public R saveAdmin(@RequestBody Admin admin){
        try {
            Boolean aBoolean = saveAdminService.saveAdmin(admin);
            return R.ok().data("data",aBoolean);
        }catch (Exception e){
            e.printStackTrace();
            return R.error();
        }
    }
}
